<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%@ page import="com.lingx.core.utils.Utils,com.lingx.core.model.bean.UserBean,com.lingx.core.service.*,com.lingx.core.Constants,com.lingx.core.service.*,com.lingx.core.model.*,java.util.*,com.alibaba.fastjson.JSON,org.springframework.context.ApplicationContext,org.springframework.web.context.support.WebApplicationContextUtils,org.springframework.jdbc.core.JdbcTemplate,java.text.DecimalFormat,java.math.BigDecimal" %>
 <%
 if(session.getAttribute("SESSION_USER")==null)return;
 	ApplicationContext spring = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext());
 	String carid=request.getParameter("carid");//
	UserBean userBean=null;
	userBean=(UserBean)session.getAttribute(Constants.SESSION_USER);
//	Map<String,Object> cache=com.lingx.jt808.IJT808Cache.CACHE_0x0200.getIfPresent(carid);
//	String str=com.lingx.jt808.utils.CoordinateConversion.wgs84togcj02(Double.parseDouble(cache.get("lng").toString()),Double.parseDouble(cache.get("lat").toString()));
// 	String arr[]=str.split(",");
// 	cache.put("lng_gaode", arr[0]);
// 	cache.put("lat_gaode", arr[1]);

    Map<String, Object> cache = new HashMap<>();
    if (carid != null) {
		JdbcTemplate jdbc = spring.getBean(JdbcTemplate.class);
		cache = jdbc.queryForMap("select tgps_car.id,carno,pinpai,lng,lat,date_format(str_to_date(gpstime,'%Y%m%d%H%i%S'), '%Y-%m-%d %H:%i:%S') as gpstime,date_format(str_to_date(systime,'%Y%m%d%H%i%S'), '%Y-%m-%d %H:%i:%S') as systime, tgps_car_with_group.name as groupname,tgps_car.remark from tgps_car,tgps_car_with_group where tgps_car.id = '" + carid + "' and tgps_car_with_group.id = '" + carid + "'");
		if (cache != null) {
			if (cache.get("lng") != null && cache.get("lat") != null) {
				DecimalFormat format = new DecimalFormat("0.000000");
				String str = com.lingx.jt808.utils.CoordinateConversion.wgs84togcj02(Double.parseDouble(cache.get("lng").toString()),Double.parseDouble(cache.get("lat").toString()));
				String arr[]=str.split(",");
				cache.put("lng_gaode", format.format(new BigDecimal(arr[0])));
				cache.put("lat_gaode", format.format(new BigDecimal(arr[1])));
			}
			if (cache.get("remark") == null) {
				cache.put("remark", "");
			}
		}
	}

 	out.println(JSON.toJSONString(cache));
 %>